﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace Onshi.POS.Modelo.Objectos
{
    public class Formato
    {
        #region Metodos

        private static String FormatoDecimal()
        {
            return String.Format("N{0}", Convert.ToInt32(ConfigurationManager.AppSettings["Decimales"]).ToString());
        }

        public static String Numero(Decimal valor)
        {
            return valor.ToString(FormatoDecimal());
        }

        public static String Moneda(Decimal valor)
        {
            return "$ " + valor.ToString(FormatoDecimal());
        }

        public static String Porcentaje(Decimal valor)
        {
            return valor.ToString(FormatoDecimal()) + "%";
        }

        public static String SiNo(Boolean valor)
        {
            return valor ? "Si" : "No";
        }

        public static String Fecha(DateTime valor)
        {
            return valor.ToString("dd/MM/yyyy");
        }

        public static String Hora(TimeSpan valor)
        {
            return valor.ToString("c");
        }

        #endregion
    }
}
